<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!--禁止用户在手机上缩放-->
    <title>000</title>
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css">
    <link rel="stylesheet" href="__AOS__/css/font-awesome.min.css">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="__JS__/html5shiv.min.js"></script>
    <script src="__JS__/response.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="__CSS__/personal_center.css">
</head>
<body>


<div class="container">
    <div class="row">
        <div class=" clo-lg-10 col-xs-12 col-md-10 col-sm-12  aaa ">
            <div class="alert alert-warning alert-dismissible hidden-xs hidden-sm hidden-md account_1" role="alert">
                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>     <!--关闭功能-->
                 上次登录时间：2017-07-19 17:33:03   地点：成都  <a href="">  查看最近操作记录</a>
            </div>
            <div class="row account_2">
                <div class="clo-lg-10 col-xs-6 col-md-10 col-sm-6">
               <strong class="account_21"> 账号绑定</strong>  完成 <i class="account_22"> 2/4</i>
                </div>
                <div class="clo-lg-2 col-xs-6 col-md-2 col-sm-6">
                    <a href="" class="question"> <font class="font2">?</font> 常见问题  </a>
                </div>
            </div>
            <div class="row account_2 ">
                <div class="clo-lg-10 col-xs-8 col-md-10 col-sm-8 email_c">
                    <div class="email_c1">

                        <div class="email_c3">
                            <div class="email_c31">
                                <font class="account_21">邮箱：</font>

                                {php}
                                if(isset($a)){
                                      if($a["email"]!=null){
                                     echo $a["email"]."<font class='account_22'><font class='hidden-xs hidden-sm hidden-md'></font></font>";
                                      }else{
                                     echo "<font class='account_22'>未绑定</font>";
                                      }
                                }else{
                                echo"<font class='account_22'>未登录<font class='hidden-xs hidden-sm hidden-md'> 请先回首页登录</font></font>";
                                }
                             {/php}
                            </div>
                            <div class="email_c32 hidden-xs hidden-sm hidden-md ">
                                <font class="tip">
                                    可用邮箱加密码登录慕课网，可用邮箱找回密码
                                </font>
                            </div>


                        </div>
                    </div>
                </div>


                {php}
                if(isset($a)){
                    if($a["email"]==null){
                        echo"<div class='clo-lg-2 col-xs-4 col-md-2 col-sm-4'>
                            <button type='button' class='btn btn-primary button_1' data-toggle='modal' data-target='#exampleModal1' > 立即绑定</button>
                            </div>";
                    }else{
                         echo"<div class='clo-lg-2 col-xs-4 col-md-2 col-sm-4'>
                        <button type='button' class='btn btn-primary button_1' data-toggle='modal' data-target='#exampleModal1' > 重绑</button>
                         </div>";
                    }
                }else{
                    echo"<div class='clo-lg-2 col-xs-4 col-md-2 col-sm-4'>
                        <button type='button' class='btn btn-primary button_1' data-toggle='modal' data-target='#exampleModal1' > 绑定</button>
                         </div>";
                }
                {/php}

                <div class="modal fade" id="exampleModal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" >绑定邮箱</h4>
                            </div>

                            <div class="modal-body">
                                <form action="{:url('personal/binding_email')}" method="post">
                                    <div class="form-group">
                                        <label  class="control-label">邮箱</label>
                                        <input type="email" class="form-control" id="email" name="email" value="{$a.email}">
                                    </div>
                                    <div class="form-group">
                                        <label  class="control-label">请输入验证码</label>
                                        <input type="text" class="form-control"  id="yam" name="code">
                                    </div>

                                    <div class="modal-footer">
                                        <input type="button"  id="getemail" value="获取验证码" onclick="isemail()" class="btn btn-default">  <!--点击关闭的按钮类-->
                                        <input type="button"   value="绑定" onclick="binding()" class="btn btn-default">  <!--点击关闭的按钮类-->
                                        <input type="reset"  value="重置" class="btn btn-primary">   <!--重置按钮-->
                                    </div>
                                </form>
                            </div>



                        </div>
                    </div>
                </div>
            </div>
            <div class="row account_2 ">
                <div class="clo-lg-10 col-xs-8 col-md-10 col-sm-8 email_c">

                            <div class="email_c31">
                                <font class="account_21">手机：</font>
                                {php}
                                if(isset($a)){
                                if($a["mobile"]!=null){
                                echo $a["mobile"]."";
                                }else{
                                echo "";
                                }
                                }else{
                                echo"<font class='account_22'>未登录<font class='hidden-xs hidden-sm hidden-md'> 请先回首页登录</font></font>";
                                }
                                {/php}
                            </div>
                            <div class="email_c32 hidden-xs hidden-sm hidden-md ">
                                <font class="tip">
                                    可用手机号加密码登录慕课网，可通过手机号找回密码 <a href="">无法绑定</a>
                                </font>
                            </div>
                        </div>
                <div class="clo-lg-2 col-xs-4 col-md-2 col-sm-4 ">
                    {php}
                    if(isset($a)){
                        if($a["mobile"]==null){
                         echo"<button type='button' class='btn btn-primary button_1' data-toggle='modal' data-target='#exampleModal2' > 绑定</button>";
                        }else{
                           echo"<button type='button' class='btn btn-primary button_1' data-toggle='modal' data-target='#exampleModal2' > 重绑</button>";
                        }
                    }else{
                    echo"<button type='button' class='btn btn-primary button_1' data-toggle='modal' data-target='#exampleModal2' > 立即绑定</button>";
                    }
                    {/php}
                </div>
                <div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" >绑定手机</h4>
                            </div>
                            <div class="modal-body">
                                <form action="{:url('personal/binding_mobile')}" method="post">
                                    <div class="form-group">
                                        <div class="form-group" >
                                            <label  class="control-label">请输入手机号码</label>
                                            <input type="text" class="form-control" value="{$a.mobile}" name="mobile">
                                        </div>
                                        <div class="form-group">
                                            <label  class="control-label">请输入验证码</label>
                                            <input type="text" class="form-control"  name="code">
                                        </div>
                                        <div class="form-group">
                                            <img class=" col-md-6 col-xs-6" src="{:captcha_src()}"  alt="captcha" onclick="this.src='{:captcha_src()}'">
                                        </div>
                                    </div>
                                    <div class="modal-footer">
                                        <input type="submit" value="绑定" class="btn btn-default">  <!--点击提交-->
                                        <input type="reset"  value="重置" class="btn btn-primary">   <!--重置按钮-->
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>




            </div>





            <div class="row account_2 ">
                <div class="clo-lg-10 col-xs-8 col-md-10 col-sm-8 email_c">
                    <div class="email_c1">
                        <div class="email_c3">
                            <div class="email_c31">
                                <font class="account_21">密码：</font>

                                {php}
                                if(isset($a)){
                                if($a["password"]!=null){
                                echo "<font class='account_22'>已设置</font>";
                                }else{
                                echo "<font class='account_22'>未设置<font class='hidden-xs hidden-sm hidden-md'> 请设置密码</font></font>";
                                }
                                }else{
                                echo"<font class='account_22'>未登录<font class='hidden-xs hidden-sm hidden-md'> 请先回首页登录</font></font>";
                                }
                                {/php}

                            </div>
                            <div class="email_c32 hidden-xs hidden-sm hidden-md ">
                                <font class="tip">
                                    用于保护账号信息和登录安全
                                </font>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clo-lg-2 col-xs-4 col-md-2 col-sm-4">
                    <button type="button" class="btn btn-primary button_1" data-toggle="modal" data-target="#exampleModal3" > 修改</button>
                </div>

                <div class="modal fade" id="exampleModal3" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="exampleModalLabel">修改密码</h4>
                            </div>
                            <div class="modal-body">
                                <form action="{:url('personal/setting_password')} " method="post">
                                    <div class="form-group">
                                        <label  class="control-label">原密码</label>
                                        <input type="text" class="form-control"  name="old_password">
                                    </div>
                                    <div class="form-group">
                                        <label  class="control-label">新密码</label>
                                        <input type="text" class="form-control" name="new_password" >
                                    </div>
                                    <div class="form-group">
                                        <label  class="control-label">请输入验证码</label>
                                        <input type="text" class="form-control"  name="code">
                                    </div>
                                    <div class="form-group">
                                        <img class=" col-md-6 col-xs-6" src="{:captcha_src()}"  alt="captcha" onclick="this.src='{:captcha_src()}'">
                                    </div>
                                    <div class="modal-footer">
                                        <input type="submit" value="确定" class="btn btn-default center_block" >  <!--点击关闭的按钮类-->
                                        <input type="reset"  value="重置" class="btn btn-primary">   <!--重置按钮-->
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>



            </div>






        </div>
    </div>



</div>
<div class="container-fluid last hidden-xs hidden-sm hidden-md">
    <!--隐藏的要一个一个写-->
    <div class="row">
        <div class="col-lg-1 hidden-xs hidden-sm hidden-md"></div>
        <div class="col-lg-8 hidden-xs hidden-sm hidden-md ">
            <ul class="last1">
                <li><a href="#" class="ss">网站首页</a></li>
                <li><a href="#" class="ss">企业合作</a></li>
                <li><a href="#" class="ss">人才招聘</a></li>
                <li><a href="#" class="ss">联系我们</a></li>
                <li><a href="#" class="ss">讲师招聘</a></li>
                <li><a href="#" class="ss">常见问题</a></li>
                <li><a href="#" class="ss">意见反馈</a></li>
                <li><a href="#" class="ss">慕课大学</a></li>
                <li><a href="#" class="ss">友情连接</a></li>
            </ul>
            <p class="last3">
                Copyright © 2017 imooc.com All Rights Reserved | 川ICP备 13046642号-2
            </p>
        </div>
        <div class=" col-lg-3 hidden-xs hidden-sm hidden-md last2">
            <div class="as">
                <i class="fa fa-weixin fa-2x"></i>
            </div>
            <div class="as">
                <i class="fa fa-qq fa-2x"></i>
            </div>
            <div class="as">
                <i class="fa fa-weibo fa-2x"></i>
            </div>

        </div>

    </div>
</div>




</body>
</html>
<script src="__JS__/jquery.min.js"></script>
<script src="__JS__/bootstrap.min.js"></script>
<script>

    function yz(str){
        var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
        return reg.test(str);
    }
    function isemail() {
         yam="";
            for (var a=0;a<4;a++){
                yam+=parseInt(Math.random()*10);
        }
//        alert(yz($("#email").val()));
        if(yz($("#email").val())){
            emailhao=$("#email").val();
                $.ajax({
                url:"{:url('Personal/emailyz')}",
                type:"post",
                dataType:"text",
                data:{
                    yam:yam,
                    email:$("#email").val()
                },
                success:function (data) {
                    alert("已发送");
                    if(data=="true"){
                            $("#getemail").attr("type","hidden")
                    }
                },
                error:function(e){
                    alert("错误 ".e.response)
                }
            })
        }
    }
    function binding() {
//        alert( $("#yam").val().trim());
//        alert( yam.trim());
        if($("#yam").val().trim()==yam.trim()){
            $.ajax({
                url:"{:url('Personal/binding')}",
                type:"post",
                dataType:"text",
                data:{
                    email:emailhao
                },
                success:function (data) {
                    if(data=="true"){
                       alert("绑定成功");
                      history.go(0)
                    }else{
                        alert("绑定失败");
                    }
                },
                error:function(e){
                    alert("视频播放出错 ".e.response)
                }
            })

        }else{
            alert("验证码错误")
        }
    }
</script>
